package com.zcxx;

import com.zcxx.generator.CodeGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication implements CommandLineRunner {

    @Autowired
    private CodeGenerator codeGenerator;

    @Value("${code.generator.enabled}")
    private boolean codeGeneratorEnabled;
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
    @Override
    public void run(String... args) throws Exception {
        if (codeGeneratorEnabled) {
            codeGenerator.generateCode(); // 根据配置决定是否生成代码
            System.out.println("代码生成完成");
        }
    }
}
